<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

//测试控制器
class LoginController extends Controller{
//private $userModel;
	//构造函数
	public function __init()
	{
//		引入方法
	$this->userModel = new \Common\Model\Homeuser;
		
	}	
	
	
	
	public function Login(){
		
		if(IS_POST){	
		$phone=Q('post.homename');		
		$password=Q('post.homepassword','','md5');
				
		$Model = new \Common\Model\Homeuser;
				
		$data=$Model->where("homename = '{$phone}'")->find();
				
//		if(!$data) View::error('用户名或密码错误');
		
//		if($data['homepassword'] != $password)View::error('用户名或密码错误');
		
		$_SESSION['uid']=$data['uid'];
		$_SESSION['phone']=$data['homename'];
		
		View::success('登陆成功',U('Index/index'));
		}
		
		View::make();
	}
	
}
